﻿@inherits AdminCompontentBase
@typeparam TValue

@if (StyleType == StyleTypes.Toggle)
{
    <MButtonGroup Class="@Class" Value="Value.ToString()" Rounded>
        @foreach (var (key, value) in KeyValues)
        {
            <MButton Style="opacity: 1 !important;" OnClick="async() => await ValueChanged.InvokeAsync(value)"  Value="@value.ToString()"
             Class="@(Value.Equals(value) ? "button-group-active emphasis--text":"button-group regular3--text")">
                @if (key == "Male")
                {
                    <SIcon Class="@(Value.Equals(value) ? "emphasis--text":"regular3--text")">fa fa-solid fa-mars</SIcon>
                }
                else if(key == "Female")
                {
                    <SIcon Class="@(Value.Equals(value) ? "emphasis--text":"regular3--text")">fa fa-solid fa-venus</SIcon>
                }
                <span class="ml-1 subtitle">@T(key)</span>
            </MButton>
        }
    </MButtonGroup>
} 
else
{
    <SLabeledRadioGroup Value="Value.ToString()" Dense>
        @foreach (var (key, value) in KeyValues)
        {
            <SLabeledRadio MinWidth=70 Value="@value.ToString()" OnClick="async() => await ValueChanged.InvokeAsync(value)">
                <span class="@(Value.Equals(value) ? "subtitle2 emphasis2--text":"btn regular2--text")">@T(key)</span>
            </SLabeledRadio>
        }
    </SLabeledRadioGroup>
}
